package com.example.demo.exception;


import com.example.demo.constant.ResultCode;

public class TokenException extends RuntimeException {

    private final int resultCode;

    public TokenException(ResultCode resultCode) {
        super(resultCode.getMessage());
        this.resultCode = resultCode.getCode();
    }

    // 静态工厂方法：无效的Token
    public static TokenException invalid() {
        return new TokenException(ResultCode.UNAUTHORIZED);
    }
}